-
Notifications
You must be signed in to change notification settings - Fork 172
Add a unit test for config_controller.go #438
Add a unit test for config_controller.go #438
Conversation
Hi @sophieliu15. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
0e22293
to
a76d711
Compare
1bd9434
to
82f9ab5
Compare
82f9ab5
to
3bfccfa
Compare
Add a unit test for config_controller.go to test the case that when a new type is added to HNCConfiguration singleton, the corresponding object reconciler can be created correctly. This PR also does the following refactoring: - Moves shared helper functions from each controller test files to a common file: test_helpers_test.go - Switches the object type in object_controller_test.go from Secret to Role because: - The behaviors that are tested in the object_controller_test.go are irrelevant to the object type or the creation of a new object reconciler. - Since the test suite creates the object reconciler for Role by default, object_controller_test.go can use the existing Role object reconciler for the tests instead of creating a new object reconciler. - The tests inside controllers_test package share the same test environment, which means if the test in one Describe container adds a type to HNCConfiguration singleton, the corresponding object reconciler for that type will be created and will still be there when running subsequent Describe containers in the package. Until we find a way to "cleanup" object reconcilers, it is better to only create new object reconcilers when necessary. Design doc: http://bit.ly/hnc-type-configuration Issue: kubernetes-retired#411
3bfccfa
to
0414e0e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
/hold
@rjbez17 feel free to remove the hold if you're happy (or don't feel like reviewing again)
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: adrianludwin, rjbez17, sophieliu15 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Add a unit test for config_controller.go to test the case that when a new type is added to HNCConfiguration singleton, the corresponding object reconciler can be created correctly.
This PR also does the following refactoring:
instead of creating a new object reconciler.
HNCConfiguration singleton, the corresponding object reconciler for that type will be created and will still be there when running subsequent Describe
containers in the package. Until we find a way to "cleanup" object reconcilers, it is better to only create new object reconcilers when necessary.
Design doc: http://bit.ly/hnc-type-configuration
Issue: #411